package com.example.shopping2.a_a_mvp.presenter.presenters

import BasePresenter
import android.util.Log
import com.example.shopping2.a_a_entity.BaseEntity
import com.example.shopping2.a_a_mvp.contract.HomeContract
import com.example.shopping2.a_c_network.LjlUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

class HomePresenter(model: HomeContract.HomeModel, view: HomeContract.HomeView) :
    BasePresenter<HomeContract.HomeModel, HomeContract.HomeView>(model, view) {
        fun requestAll(list: ArrayList<HashMap<String,Any>>){
            mymodel.requestAll(list)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(this)

        }

    override fun onNext(t: BaseEntity) {
        super.onNext(t)
        if (t.status.equals("0")){

        }else{
            LjlUtils.Ljl_Loge("presenter---"+t.message)
        }
        myview.showHomeData(t)
    }
}